package cn.leida.ruoyi.common.core.domain.entity;

import cn.leida.ruoyi.common.annotation.Excel;
import cn.leida.ruoyi.common.core.domain.BaseEntity;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;


/**
 * 字典类型表 sys_dict_type
 *
 * @author liutietou
 * @since 1.0  2020-12-11
 */
@Data
@Entity
@Table(name = "sys_dict_type")
public class SysDictType extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 字典主键
     */
    @Excel(name = "字典主键", cellType = Excel.ColumnType.NUMERIC)
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "dict_id")
    private Long dictId;

    /**
     * 字典名称
     */
    @Excel(name = "字典名称")
    @NotBlank(message = "字典名称不能为空")
    @Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符")
    @Column(name = "dict_name",length = 100)
    private String dictName;

    /**
     * 字典类型
     */
    @Excel(name = "字典类型")
    @NotBlank(message = "字典类型不能为空")
    @Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符")
    @Column(name = "dict_type",length = 100)
    private String dictType;

    /**
     * 状态（0正常 1停用）
     */
    @Excel(name = "状态", readConverterExp = "0=正常,1=停用")
    @Column(name = "status",length = 10)
    private String status;

    /**
     * 创建者
     */
    @Column(name = "create_by",length = 64)
    private String createBy;

    /**
     * 创建时间
     */
    @Column(name = "create_time", length =30)
    private String createTime;

    /**
     * 更新者
     */
    @Column(name = "update_by",length = 64)
    private String updateBy;

    /**
     * 更新时间
     */
    @Column(name = "update_time",length = 30)
    private String updateTime;

    /**
     * 备注
     */
    @Column(name = "remark",length = 500)
    private String remark;

    public void initUpdateTime() {
        updateTime = nowTime();
    }

    public void initCreateTime() {
        createTime = nowTime();
    }
}
